﻿@model Orchard.Search.ViewModels.SearchSettingsViewModel
@using Orchard.Search.ViewModels;

<fieldset>
    <legend>@T("Search")</legend>
    <div>
        @{var entryIndex = 0;}

        @if (Model.Entries != null && Model.Entries.Any()) {
        <ul>
            @foreach(var modelEntry in Model.Entries) {
            <li>
               @if(Model.Entries[entryIndex].Selected) {
               
                <input type="checkbox" value="true" checked="checked" name="@Html.FieldNameFor(m => m.Entries[entryIndex].Selected)" id="@Html.FieldIdFor(m => m.Entries[entryIndex].Selected)"/>
              
               }
               else {
                 <input type="checkbox" value="true" name="@Html.FieldNameFor(m => m.Entries[entryIndex].Selected)" id="@Html.FieldIdFor(m => m.Entries[entryIndex].Selected)"/> 
               }
               @Html.HiddenFor(m => m.Entries[entryIndex].Field)
               <label class="forcheckbox" for="@Html.FieldIdFor(m => m.Entries[entryIndex].Selected)">@Model.Entries[entryIndex].Field</label>
            </li>
               entryIndex = entryIndex + 1;
            }
        </ul>
        }

        else {
            <span class="hint">@T("There are currently no fields to search from. Please update you index, and check some indexable content exists.")</span>
        }
    </div>
</fieldset>
